
#include "genericcaptchafetcher.h"
#include "genericcaptchafetcher_impl.h"

namespace Wishmaster
{
	GenericCaptchaFetcher::GenericCaptchaFetcher() :
		impl(new GenericCaptchaFetcherImpl())
	{
		connect(impl.get(), SIGNAL(captcha(ThreadId,QByteArray)), this, SLOT(captcha_result(ThreadId,QByteArray)));
	}

	GenericCaptchaFetcher::~GenericCaptchaFetcher()
	{
	}

	QString GenericCaptchaFetcher::id()
	{
		return "generic";
	}

	CaptchaFetcher* GenericCaptchaFetcher::clone(Wishmaster2::Network::RequestManager* requestManager, const QVariantMap& params)
	{
		GenericCaptchaFetcher* fetcher = new GenericCaptchaFetcher();
		fetcher->impl->setRequestManager(requestManager);
		fetcher->impl->setParams(params);
		return fetcher;
	}

	void GenericCaptchaFetcher::fetchCaptcha(const ThreadId& threadId)
	{
		impl->fetchCaptcha(threadId);
	}

	void GenericCaptchaFetcher::captcha_result(const ThreadId& id, const QByteArray& arr)
	{
		//log(llWarning, "GenericCaptchaFetcher::captcha_result");
		emit captcha(id, arr);
	}

	void GenericCaptchaFetcher::processRequest(const PostDescriptor& post, const QString& captcha, const Wishmaster2::Network::RequestPtr& request)
	{
	}
}

